package pqt;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Image;
import java.awt.Toolkit;

import javax.swing.FocusManager;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Button;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.SystemColor;

public class testBoton extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					testBoton frame = new testBoton();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public testBoton() {
		setResizable(false);
		setForeground(SystemColor.activeCaption);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 611, 473);
		contentPane = new JPanel();
		
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		//-------------------------------------------------------------------------------------------------------------------------
		final JButton btnAceptar = new JButton("");
		
		btnAceptar.setIcon(new ImageIcon(testBoton.class.getResource("/img/AceptarAzulGrande.png")));
		btnAceptar.setBounds(97, 36, 374, 100);
		btnAceptar.setBorder(null);
		btnAceptar.setFocusable(true);
		btnAceptar.setBorderPainted(false);
		btnAceptar.setContentAreaFilled(false);
		btnAceptar.setPressedIcon(new ImageIcon(testBoton.class.getResource("/img/AceptarBlancoGrande.png")));
		contentPane.add(btnAceptar);
		
		
		btnAceptar.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent arg0) {
				btnAceptar.setIcon(new ImageIcon(testBoton.class.getResource("/img/AceptarVerdeGrande.png")));
				getRootPane().setDefaultButton(btnAceptar);
				
			}
			@Override
			public void mouseExited(MouseEvent e) {
				btnAceptar.setIcon(new ImageIcon(testBoton.class.getResource("/img/AceptarAzulGrande.png")));
				getRootPane().setDefaultButton(null);
				
			}
		});
		btnAceptar.addFocusListener(new FocusAdapter() {
			@Override
			public void focusGained(FocusEvent arg0) {
				btnAceptar.setIcon(new ImageIcon(testBoton.class.getResource("/img/AceptarVerdeGrande.png")));
				getRootPane().setDefaultButton(btnAceptar);
				
			}
			@Override
			public void focusLost(FocusEvent e) {
				btnAceptar.setIcon(new ImageIcon(testBoton.class.getResource("/img/AceptarAzulGrande.png")));
				getRootPane().setDefaultButton(null);
			}
		});
	//-------------------------------------------------------------------------------------------------------------------------
		final JButton btnCancelar = new JButton("");
		btnCancelar.setFocusable(true);
		btnCancelar.setContentAreaFilled(false);
		btnCancelar.setBorderPainted(false);
		btnCancelar.setBorder(null);
		btnCancelar.setBounds(97, 184, 374, 100);
		btnCancelar.setIcon(new ImageIcon(testBoton.class.getResource("/img/CancelarAzulGrande.png")));
		btnCancelar.setPressedIcon(new ImageIcon(testBoton.class.getResource("/img/CancelarBlancoGrande.png")));
		contentPane.add(btnCancelar);
		
		btnCancelar.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent arg0) {
				btnCancelar.setIcon(new ImageIcon(testBoton.class.getResource("/img/CancelarRojoGrande.png")));
				getRootPane().setDefaultButton(btnCancelar);
				
			}
			@Override
			public void mouseExited(MouseEvent e) {
				btnCancelar.setIcon(new ImageIcon(testBoton.class.getResource("/img/CancelarAzulGrande.png")));
				getRootPane().setDefaultButton(null);
			}
		});
		btnCancelar.addFocusListener(new FocusAdapter() {
			@Override
			public void focusGained(FocusEvent arg0) {
				btnCancelar.setIcon(new ImageIcon(testBoton.class.getResource("/img/CancelarRojoGrande.png")));
				getRootPane().setDefaultButton(btnCancelar);
			}
			@Override
			public void focusLost(FocusEvent e) {
				btnCancelar.setIcon(new ImageIcon(testBoton.class.getResource("/img/CancelarAzulGrande.png")));
				getRootPane().setDefaultButton(null);
			}
		});
	//-------------------------------------------------------------------------------------------------------------------------------------
	
		final JButton btnIngresar = new JButton("");
		btnIngresar.setFocusable(true);
		btnIngresar.setContentAreaFilled(false);
		btnIngresar.setBorderPainted(false);
		btnIngresar.setBorder(null);
		btnIngresar.setBounds(97, 322, 374, 100);
		btnIngresar.setIcon(new ImageIcon(testBoton.class.getResource("/img/LoginAzulGrande.png")));
		btnIngresar.setPressedIcon(new ImageIcon(testBoton.class.getResource("/img/LoginBlancoGrande.png")));
		contentPane.add(btnIngresar);
		
		JLabel fondo = new JLabel("");
		fondo.setBounds(0, 0, 605, 446);
		fondo.setFocusable(false);
		fondo.setIcon(new ImageIcon(testBoton.class.getResource("/img/fondo.png")));
		contentPane.add(fondo);
		
		btnIngresar.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent arg0) {
				btnIngresar.setIcon(new ImageIcon(testBoton.class.getResource("/img/LoginVerdeGrande.png")));
				getRootPane().setDefaultButton(btnIngresar);
				
			}
			@Override
			public void mouseExited(MouseEvent e) {
				btnIngresar.setIcon(new ImageIcon(testBoton.class.getResource("/img/LoginAzulGrande.png")));
				getRootPane().setDefaultButton(null);
			}
		});
		btnIngresar.addFocusListener(new FocusAdapter() {
			@Override
			public void focusGained(FocusEvent arg0) {
				btnIngresar.setIcon(new ImageIcon(testBoton.class.getResource("/img/LoginVerdeGrande.png")));
				getRootPane().setDefaultButton(btnIngresar);
			}
			@Override
			public void focusLost(FocusEvent e) {
				btnIngresar.setIcon(new ImageIcon(testBoton.class.getResource("/img/LoginAzulGrande.png")));
				getRootPane().setDefaultButton(null);
			}
		});
		
	}
}
